package com.cash.app.net

import com.google.gson.annotations.SerializedName
import com.cash.app.net.NetConstant.BRP_MSG
import com.cash.app.net.NetConstant.BRP_RESULT
import com.cash.app.net.NetConstant.BRP_RETURN_CODE
import com.cash.app.net.NetConstant.RESPONSE_SUCCESS

data class BaseResponse<T>(
    @SerializedName(BRP_RETURN_CODE) val returnCode: Int,
    @SerializedName(BRP_MSG) val msg: String,
    @SerializedName(BRP_RESULT) val result: T? // custom data, nullable
) {
    /**
     * returnCode == RESPONSE_SUCCESS == 0
     */
    fun isSuccess() = returnCode == RESPONSE_SUCCESS
}
